package database;

import java.sql.*;

public class BaseResourcePost  { 
	public static final String PASSWD  = "RESOURCEPOST.PASSWD"; 
	public static final String PORT  = "RESOURCEPOST.PORT"; 
	public static final String ADDRESS  = "RESOURCEPOST.ADDRESS"; 
	public static final String NICKNAME  = "RESOURCEPOST.NICKNAME"; 
	protected boolean saved  = false; 
	protected String username  = "anonymous"; 
	protected Date time; 
	protected String resourcename; 
	protected int id; 
	protected String nickname  = "anonymous"; 
	protected String address; 
	protected int port  = 21; 
	protected String passwd  = "anonymous"; 
	public static final String ID  = "RESOURCEPOST.ID"; 
	public static final String RESOURCENAME  = "RESOURCEPOST.RESOURCENAME"; 
	public static final String TIME  = "RESOURCEPOST.TIME"; 
	public static final String USERNAME  = "RESOURCEPOST.USERNAME"; 

	public void save()
	throws Exception{ 
		if(saved){
			BaseResourcePostPeer.doUpdate(this);
		}else{
			BaseResourcePostPeer.doInsert(this);
		}
	} 

	public String getUsername(){ 
		return username;
	} 

	public Date getTime(){ 
		return time;
	} 

	public String getResourcename(){ 
		return resourcename;
	} 

	public void setNickname(String args0){ 
		nickname =args0;
	} 

	public void setAddress(String args0){ 
		address =args0;
	} 

	public void setPort(int args0){ 
		port =args0;
	} 

	public void setPasswd(String args0){ 
		passwd =args0;
	} 

	public String getPasswd(){ 
		return passwd;
	} 

	public int getPort(){ 
		return port;
	} 

	public String getAddress(){ 
		return address;
	} 

	public String getNickname(){ 
		return nickname;
	} 

	/**
	  * id is autogenerated 
	*/
	public int getId(){ 
		return id;
	} 

	public void setResourcename(String args0){ 
		resourcename =args0;
	} 

	public void setTime(Date args0){ 
		time =args0;
	} 

	public void setUsername(String args0){ 
		username =args0;
	} 
}